//
//  SISSHandHouseViewController.m
//  SISSAPP
//
//  Created by 袁应荣 on 2018/12/27.
//  Copyright © 2018 优房网. All rights reserved.
//

#import "SISSHandHouseViewController.h"
#import "SISSNetworkingManager+HouseProgress.h"

@interface SISSHandHouseViewController ()

@end

@implementation SISSHandHouseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tipStr = @"基本流程";
    
    if (self.houseProgressModel) {
        self.bottomButtonStr = (self.isHistory && self.houseProgressRecordInfoModel.hasHandhouse == 0) ? @"" : (self.houseProgressRecordInfoModel.hasHandhouse == 1 ? @"已交房" : @"确认交房");
    } else {
        self.bottomButtonStr = (self.isHistory && self.passengerProgressRecordInfoModel.hasHandhouse == 0) ? @"" : (self.passengerProgressRecordInfoModel.hasHandhouse == 1 ? @"已交房" : @"确认交房");
    }
    
    self.textStr = @" 1、买方点交房屋时，检验房屋现况，核对附赠设备是否符合，税费、水电、煤气、电话、有线电视及管理费用是否结算及过户，取回钥匙、过户凭证等；\n\n2、卖方现场点交房屋、税费、水电、煤气、电话、有线电视及管理费过户清单，由银行监管账户将尾款及剩余的交房保证金打入卖方账户；\n\n3、所有点交事宜交接完毕后，买卖双方须在交楼确认书上签字。";
}


- (void)startButtonClickAction {
    
    if (self.houseProgressRecordInfoModel.hasHandhouse == 0) {
        NSString *ahbpId = self.houseProgressModel ? self.houseProgressModel.ahbpId : self.passengerProgressRecordInfoModel.ahbpId;
        NSString *adbpId = self.houseProgressModel ? self.houseProgressRecordInfoModel.adbpId : self.passengerProgressModel.adbpId;
        NSString *ahrId = self.houseProgressModel ? self.houseProgressModel.house.ID : @"";
        NSString *abdId = self.houseProgressModel ? @"" : self.passengerProgressModel.demand.ID;
        NSDictionary *parameters = @{
                                     @"spId": [SISSUserAccount shared].spId,
                                     @"ahbpId": ahbpId,
                                     @"adbpId": adbpId,
                                     @"ahrId": ahrId,
                                     @"abdId": abdId,
                                     @"demandType": @(self.houseProgressRecordInfoModel.demand_type),
                                     @"houseType": @(self.houseProgressModel.houseresType),
                                     @"spId": [SISSUserAccount shared].spId,
                                     @"state": @"1"
                                     };
        [kNetworkManager insertHandHouseInfoWithParamters:parameters success:^(id responseObject) {
            if ([responseObject[@"code"] integerValue] == 200) {
                [self.navigationController popViewControllerAnimated:YES];
            }
        } failed:^(NSError *error) {
            NSLog(@"%@",error);
        }];
        
    }
}


@end
